package com.spring_mysql_redis.controller;


import com.spring_mysql_redis.annotation.CurrentUser;
import com.spring_mysql_redis.entity.Users;
import com.spring_mysql_redis.model.ResultFormat;
import com.spring_mysql_redis.utils.FilesUtils;
import com.spring_mysql_redis.utils.ResultUtil;
import com.spring_mysql_redis.utils.TimeUtitl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件管理")
@RestController
@RequestMapping("/files")
public class FileController {
    private Logger logger = LoggerFactory.getLogger(FileController.class);

    @Autowired
    private FilesUtils filesUtils;

    @ApiOperation("上传文件接口")
    @PostMapping("/upFiles")
    @ResponseBody
    public ResultFormat upIconPgSorts(@RequestParam("file") MultipartFile file) {
        String url = filesUtils.upFilesPgSorts(file);
        return ResultUtil.success(url);
    }
}
